![]() All 3D modeling programs are different: they differ in the terminology of their manuals, the way they represent materials and textures, and in the way that data renders to the screen. This chapter provides a cosmological view of 3D models and modeling programs. This background can help you understand the differences between 3D programs and the compromises required by translators such as Interchange. Coordinate
systems Interchange maintains the convention of the "X" direction being to the left and right, "Y" into and out of the screen, and "Z" up and down. For example, this is the convention in the text generated by the Statistics Converter. Other programs differ: LightWave, for example, has "Y" meaning up and down with "Z" being in and out of the screen. Other programs might label the axes the same way, but disagree in the choice of direction of the positive Y direction, or disagree in the definition of positive and negative rotation angles. Some programs let you change the labelling of the axes in the user interface although the internal format uses a different system. The software industry is not immune to a lack of standard notations. Examine any three books on computer graphics or computer mathematics. They probably don't agree on these conventions, either. Interchange resolves these disagreements, insuring that converted objects have the same orientation. This question also arises when converting a 2D drawing into 3D. Should the flat drawing be placed on the floor or a wall? Points The location of a point is specified as three numbers, the distance along the X, Y and Z coordinate axes. These three values define the point in space. There are many ways to represent coordinate values in a file. The easiest to understand is an ASCII representation, such as the stream of bytes "3.14159" found in an AutoCAD DXF file. The microprocessor is more comfortable performing math using two bytes to represent integers between 0 and 65,335, or four byte integers to store values between 0 and 4,294,967,295. "Floating point" systems re-interpret those four bytes in a different way to represent values that have both an integer and fractional part. Floating point values come in standard formats such as IEEE-754 or Motorola FFP "fast floating point." Each 3D program uses a number format suited to its function, chosen by the program's designers. Converting between different number systems can lead to round-off errors or inaccuracies in the geometry of an object. Converting a floating-point object to an integer format is difficult without compromise. In some 3D file formats, it might be impossible to represent an object that is both large (in dimension, not file size) and yet accurate in small details. Edges and Polygons Many 3D programs keep separate lists for points, edges, and polygonal faces. When you create a polygon, its points and edges are automatically added to the database. Different 3D bookkeeping methods lead to incompatibilities when translating between 3D programs. Connect two points in space by a straight line, and you have an edge or side. There is a clear relationship between the number of sides in a polygon and the number of points in the polygon: a triangle has three points, a square has four, a pentagon has five, etc. Some programs allow you to create points and edges that are very much a part of the model, but not part of any polygon. Interchange will interpret these "lone points" and "lone edges" as polygons with one and two sides, respectively. Not all programs support these ideas of polygons. Some programs support only triangles while others allow polygons with up to five sides, while others allow up to 65,000 sides. For example, 3D Studio and Imagine restrict objects to triangles. To make a square, you need two adjacent triangles. 3D Studio can hide the diagonal edge, making these two triangles appear like a square. Each 3D program has its own limits. For example, one program might limit objects to 32,767 points while another allows 65,535 points. It might not be possible to convert an object between these formats. For example, compare the way LightWave, Sculpt, and 3D Studio represent 3D data: LightWave keeps lists of points and polygons, but no edges. Instead of separate edges, it allows "polygons" with just one or two points, as well as polygons with three or more points. One-point polygons render to the screen as a visible point covering one or more pixels, as if the point had volume. Two-point polygons render as lines of one or more pixels in width. Three and many-point polygons render as solid areas. Sculpt keeps separate lists of points, edges and triangular polygons. It is possible to make lone points and lone edges that are not part of any polygon. In the editor, Sculpt shows all the points and edges, but polygons are only visible from their points and edges. In wireframe rendering, only edges are drawn. In other rendering modes, only polygons appear. 3D Studio keeps lists of points and triangular polygons. Only triangles can be stored and rendered, although the visibility of edges in polygons can be controlled for editing purposes. In some programs, very thin polygons always render as at least one pixel wide on the screen. In others, thin polygons disappear as they move farther from the camera. Triangulation On the other hand, when converting a triangle-based object to a format that allows both triangles and many-sided polygons, in most cases Interchange does not automatically join adjacent triangles to form polygons with more sides. For example, if you create a square object in Wavefront by placing two triangles next to each other, Interchange doesn't convert the two triangles to a LightWave polygon with four sides. There are several reasons why the triangular version may be superior. Depending on the program's rendering technique, a many-sided region may render more accurately when broken down into triangles. The many-sided polygon is more likely to disappear behind another polygon, or in front of another object that is actually behind it. Some programs determine depth (and therefore layering and rendering order) based on an average center point instead of true intersections between polygons. Orientation Polygon orientation does not concern some programs. Other programs have options to set materials as "double-sided," meaning both sides are visible. Converting an object with randomly oriented polygons to a format that requires orientation can be solved in any case by doubling the polygons by creating copies of each polygon, listed in the opposite order. Smoothing A common method of checking if two polygons are adjacent is by asking the database to see if they have any points in common. Instead of comparing three (X, Y and Z) coordinates for each point, programs compare the indexes of the polygon's points in the point list. For example, if both polygons share points 10 and 30, then their common boundary is smoothed. Similarly, hard (not smoothed) boundaries can be enforced by creating points that have the same X, Y, Z location as other points, but with different indexes in the point list. Two polygons might have points in common in space, but the points don't have the same index in the point list, therefore, the program doesn't think they're the same point. Some programs use the terms "welded" and "unwelded" to describe this situation. Material
attributes At the simplest level, polygons have color, usually set in terms of red, green and blue. Some programs allow an unlimited number of materials, others are restricted to limited palettes. Most programs extend material definitions to include the color of reflected light, the amount of transparency to the object, the color of light after it passes through a transparent object, how much light bends or refracts while passing through an object, and the size and color of shiny highlights, and many other attributes. Most programs can wrap bitmap images onto objects, creating a texture map. Interchange's materials are very similar to those used in today's most popular programs. For a complete description, see the "Interchange Objects" chapter. Hierarchies Not all 3D programs store an entire hierarchy in a single file. When converting a hierarchical object to a format that does not support separable hierarchies, Interchange coalesces the sub-objects into a single object. Also, some programs might allow an object to be composed of separate pieces, but no hierarchy is implied - for example, AutoCAD uses "layers" to arrange a drawing. Other object data types Interchange does not translate splines
and patches or NURBS surfaces.
|